#include "stdafx.h"
#include "EnumList.h"

EnumList::EnumList() : count(1), head(NULL)
{
}

EnumList::~EnumList()
{
    Release();
}

ULONG EnumList::AddRef()
{
    return ++count;
}

ULONG EnumList::Release()
{
    if (count == 0) return 0;
    if (--count) return count;
    while (head)
    {
        EnumItem *item = head;
        head = head->next;
        VariantClear(&item->data);
        delete item;
    }
    return 0;
}
